//
//  CommonDefine.h
//  RBIOSBase
//
//  Created by ren on 21/11/2017.
//  Copyright © 2017 bryan. All rights reserved.
//

#ifndef CommonDefine_h
#define CommonDefine_h

typedef void(^WebImageNoParamsBlock)();

typedef void(^WebImageCheckCacheCompletionBlock)(BOOL isInCache);

#if OS_OBJECT_USE_OBJC
	#undef SDDispatchQueueRelease
	#undef SDDispatchQueueSetterSementics
	#define SDDispatchQueueRelease(q)
	#define SDDispatchQueueSetterSementics strong
#else
	#undef SDDispatchQueueRelease
	#undef SDDispatchQueueSetterSementics
	#define SDDispatchQueueRelease(q) (dispatch_release(q))
	#define SDDispatchQueueSetterSementics assign
#endif

#ifndef dispatch_main_async_safe
#define dispatch_main_async_safe(block)\
	if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) == 0)\
	{\
		block();\
	}\
	else \
	{\
		dispatch_async(dispatch_get_main_queue(), block);\
	}
#endif

//#ifndef dispatch_main_async_safe
//#define dispatch_main_async_safe(block)\
//if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) == 0) {\
//block();\
//} else {\
//dispatch_async(dispatch_get_main_queue(), block);\
//}
//#endif

#endif /* CommonDefine_h */
